home *** CD-ROM | disk | FTP | other *** search
- /*
- --------------- D O M E N U
-
- May 1989 - HA OLIVER
- */
-
-
- #include "Demo.h"
-
- extern MenuHandle myMenus[LastMenu];
- extern Boolean notFinished,isDoc;
- extern TEHandle CurrentText;
- extern ListHandle CurrentList;
- extern WindowPtr CurrentPort;
-
- extern pascal void MyWindow(),MyControl();
-
-
- /*
- ---------------------- Menu choice.
- */
-
- doMenu(result)
- long result;
- {
- int theItem,theMenu;
- Str255 name;
-
- theMenu=HiWord(result);
- theItem=LoWord(result);
- switch(theMenu)
- {
- case AppleM :switch(theItem)
- {
- case AboutCom:break;
- default :GetItem(myMenus[1],theItem,&name);
- OpenDeskAcc(&name);break;
- }
- break;
-
- case FileM :switch(theItem)
- {
- case Example1 :doExample1();break;
- case Example2 :doExample2();break;
- case Example3 :doExample3();break;
- case Example4 :doExample4();break;
- case Example5 :doExample5();break;
- case QuitCom :notFinished=FALSE;break;
- }
- break;
- }
- HiliteMenu(0);
- }
-
- /*
- ---------------------- Example1
- */
-
- doExample1()
- {
- WindowPtr theWindow;
- OSErr err;
-
- err =InstalWindow(&theWindow,16001,MyWindow,false);
- if (err==0)
- {
- err =InstalText(6001,theWindow);
- err =InstalText(6002,theWindow);
- err =InstalList(7001,theWindow);
- err =InstalPict(8002,theWindow);
- DisableItem(myMenus[2],1);
- SetWTitle(theWindow,"\pExample #1");
- ShowWindow(theWindow);
- isDoc=true;
- }
- }
-
- doExample2()
- {
- WindowPtr theWindow;
- OSErr err;
-
- err =InstalWindow(&theWindow,16002,MyWindow,false);
- if (err==0)
- {
- err =InstalText(6003,theWindow);
- err =InstalList(7002,theWindow);
- err =InstalPict(8001,theWindow);
- DisableItem(myMenus[2],2);
- SetWTitle(theWindow,"\pExample #2");
- ShowWindow(theWindow);
- isDoc=true;
- }
- }
-
- doExample3()
- {
- WindowPtr theWindow;
- OSErr err;
-
- err =InstalWindow(&theWindow,16003,MyWindow,false);
- if (err==0)
- {
- err =InstalPict(8003,theWindow);
- DisableItem(myMenus[2],3);
- SetWTitle(theWindow,"\pExample #3");
- ShowWindow(theWindow);
- isDoc=true;
- }
- }
-
- doExample4()
- {
- WindowPtr theWindow;
- OSErr err;
-
- err =InstalWindow(&theWindow,16004,MyWindow,false);
- if (err==0)
- {
- err =InstalList(7003,theWindow);
- err =InstalControl(8001,MyControl,theWindow);
- err =InstalControl(8002,MyControl,theWindow);
- err =InstalControl(8003,MyControl,theWindow);
- DisableItem(myMenus[2],4);
- SetWTitle(theWindow,"\pExample #4");
- ShowWindow(theWindow);
- isDoc=true;
- }
- }
-
- doExample5()
- {
- WindowPtr theWindow;
- OSErr err;
-
- err =InstalWindow(&theWindow,16005,MyWindow,false);
- if (err==0)
- {
- err =InstalList(7004,theWindow);
- err =InstalList(7003,theWindow);
- DisableItem(myMenus[2],5);
- SetWTitle(theWindow,"\pExample #5");
- ShowWindow(theWindow);
- isDoc=true;
- }
- }
- /*
- ----------------------
- */
-